Optimal. Leaf size=103 \[ \frac {-3 B+i A}{4 a^2 d (1+i \tan (c+d x))}-\frac {x (A+3 i B)}{4 a^2}+\frac {B \log (\cos (c+d x))}{a^2 d}+\frac {(-B+i A) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.21, antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3595, 3589, 3475, 12, 3526, 8} \[ \frac {-3 B+i A}{4 a^2 d (1+i \tan (c+d x))}-\frac {x (A+3 i B)}{4 a^2}+\frac {B \log (\cos (c+d x))}{a^2 d}+\frac {(-B+i A) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 12
Rule 3475
Rule 3526
Rule 3589
Rule 3595
Rubi steps
\begin {align*} \int \frac {\tan ^2(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx &=\frac {(i A-B) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {\int \frac {\tan (c+d x) (2 a (i A-B)+4 i a B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx}{4 a^2}\\ &=\frac {(i A-B) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {i \int -\frac {2 a^2 (A+3 i B) \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{4 a^3}-\frac {B \int \tan (c+d x) \, dx}{a^2}\\ &=\frac {B \log (\cos (c+d x))}{a^2 d}+\frac {(i A-B) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {(i A-3 B) \int \frac {\tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{2 a}\\ &=\frac {B \log (\cos (c+d x))}{a^2 d}+\frac {(i A-B) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {i A-3 B}{4 d \left (a^2+i a^2 \tan (c+d x)\right )}-\frac {(A+3 i B) \int 1 \, dx}{4 a^2}\\ &=-\frac {(A+3 i B) x}{4 a^2}+\frac {B \log (\cos (c+d x))}{a^2 d}+\frac {(i A-B) \tan ^2(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {i A-3 B}{4 d \left (a^2+i a^2 \tan (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.07, size = 185, normalized size = 1.80 \[ \frac {\sec ^2(c+d x) \left (\cos (2 (c+d x)) \left (4 A d x+i A-8 B \log \left (\cos ^2(c+d x)\right )-4 i B d x-B\right )+4 i A d x \sin (2 (c+d x))+A \sin (2 (c+d x))-4 i A+i B \sin (2 (c+d x))+4 B d x \sin (2 (c+d x))-8 i B \sin (2 (c+d x)) \log \left (\cos ^2(c+d x)\right )+16 i B \tan ^{-1}(\tan (d x)) (\cos (2 (c+d x))+i \sin (2 (c+d x)))+8 B\right )}{16 a^2 d (\tan (c+d x)-i)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.69, size = 84, normalized size = 0.82 \[ -\frac {{\left (4 \, {\left (A + 7 i \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} - 16 \, B e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - {\left (4 i \, A - 8 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, A - B\right )} e^{\left (-4 i \, d x - 4 i \, c\right )}}{16 \, a^{2} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.76, size = 107, normalized size = 1.04 \[ -\frac {\frac {2 \, {\left (i \, A + B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (-i \, A + 7 \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} + \frac {3 i \, A \tan \left (d x + c\right )^{2} - 21 \, B \tan \left (d x + c\right )^{2} - 6 \, A \tan \left (d x + c\right ) + 22 i \, B \tan \left (d x + c\right ) + 5 i \, A + 5 \, B}{a^{2} {\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.21, size = 162, normalized size = 1.57 \[ -\frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}-\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}+\frac {i A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}+\frac {5 i B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}+\frac {3 A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}+\frac {i \ln \left (\tan \left (d x +c \right )-i\right ) A}{8 d \,a^{2}}-\frac {7 \ln \left (\tan \left (d x +c \right )-i\right ) B}{8 d \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.29, size = 114, normalized size = 1.11 \[ \frac {\frac {A}{2\,a^2}+\frac {B\,1{}\mathrm {i}}{a^2}+\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {5\,B}{4\,a^2}+\frac {A\,3{}\mathrm {i}}{4\,a^2}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{8\,a^2\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-7\,B+A\,1{}\mathrm {i}\right )}{8\,a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.86, size = 224, normalized size = 2.17 \[ \frac {B \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{2} d} + \begin {cases} \frac {\left (\left (- 4 i A a^{2} d e^{2 i c} + 4 B a^{2} d e^{2 i c}\right ) e^{- 4 i d x} + \left (16 i A a^{2} d e^{4 i c} - 32 B a^{2} d e^{4 i c}\right ) e^{- 2 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text {for}\: 64 a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (- \frac {- A - 7 i B}{4 a^{2}} + \frac {i \left (i A e^{4 i c} - 2 i A e^{2 i c} + i A - 7 B e^{4 i c} + 4 B e^{2 i c} - B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (A + 7 i B\right )}{4 a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________